using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace PACKETPARSERMAX20.CORE
{
	public class skill_extra_item_template : MangosBase
	{
		public System.UInt32? spellid;
		public System.UInt32? requiredspecialization;
		public System.Single? additionalcreatechance;
		public System.Byte? additionalmaxnum;




		public override string GetInsertCommand()
		{
			return string.Format("INSERT IGNORE INTO `skill_extra_item_template` (`spellid`, `requiredspecialization`, `additionalcreatechance`, `additionalmaxnum`) VALUES ('{0}', '{1}', '{2}', '{3}');", spellid.GetValueOrDefault(), requiredspecialization.GetValueOrDefault(), additionalcreatechance.GetValueOrDefault(), additionalmaxnum.GetValueOrDefault());
		}


		public override string GetUpdateCommand()
		{
            StringBuilder sb = new StringBuilder();
						sb.Append("UPDATE `skill_extra_item_template` SET ");
			if(requiredspecialization != null)
			{
				sb.AppendLine("`requiredspecialization`='" + requiredspecialization.Value.ToString() + "'");
			}
			if(additionalcreatechance != null)
			{
				sb.AppendLine("`additionalcreatechance`='" + additionalcreatechance.Value.ToString() + "'");
			}
			if(additionalmaxnum != null)
			{
				sb.AppendLine("`additionalmaxnum`='" + additionalmaxnum.Value.ToString() + "'");
			}
				sb = sb.Replace("\r\n", ", ");
				sb.Append(" WHERE `spellid`='" + spellid.Value.ToString() + "';");
				sb = sb.Replace(",  WHERE", " WHERE");

            return sb.ToString();
		}


	}
}
